<?php session_start();?>
<?php 
	if($_SESSION['username']=="admin"){
		$unit = $_REQUEST['unit'];
	}
	else{
		$unit = $_SESSION['username'];
	}

?>
<html>
	<head>
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8rc2.custom.min.js"></script>
	<link type="text/css" href="css/redmond/jquery-ui-1.8rc2.custom.css" rel="stylesheet" />	
	<link type="text/css" href="css/date.css" rel="stylesheet" />	
	<script type="text/javascript" src="js/viewaccount.js.php?unit=<?php echo $_REQUEST['unit']?>">
	</script>
	</head>
	<body onload="viewAccount();viewFinancialInfo();">
		<h2>Unit <?php echo $unit?></h2>
		<?php if(($_SESSION['username'])=="admin"&&!isset($_REQUEST['unit'])){?>
		<script type="text/javascript">
			<!--
			function delayer(){
				window.location = "index.php";
			}
			setTimeout('delayer()', 1);
			//-->
		</script>
		<?php }
		
		require_once("models/Unit.php");
		$unit = new Unit;
		$unit->connect();
		if(($_SESSION['username'])=="admin"&&isset($_REQUEST['unit'])){
			if($unit->isOccupied($_REQUEST['unit'])){?>
				<div id="changePasswordForm" title="Change Password">
				</div>
				<a href="#" onclick="viewChangePasswordForm()"/>Change Password</a><br />
				<a href="#" onclick="addpayment();">Add Payment</a>
				<div id="addpaymentform" title="Add Payment">
				</div>
			<?php }
		}
		
		
		?>
		<div id="accountForm">
		</div>
		<div id="financeForm">
		</div>

	</body>
</html>